home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 24
/
AACD 24.iso
/
AACD
/
Information
/
WebSites
/
Eyetech
/
DOWNLOAD
/
PARNE030.LHA
/
parnet
/
test
/
defs.h
next >
Wrap
C/C++ Source or Header
|
1993-04-06
|
3KB
|
131 lines
/*
* DEFS.H
*
* ---- NOTE, ONLY IOREQUEST STRUCTURE IS PUBLIC, ALL OTHER STRUCTURES
* **WILL** CHANGE WITHOUT NOTICE ----
*/
#define PARNET_SRC
#include <devices/trackdisk.h>
#include <devices/timer.h>
#include <hardware/intbits.h>
#include <exec/exec_protos.h>
#include <exec/errors.h>
#include <exec/interrupts.h>
#include <dos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PORTNAME "parnet.cfg"
#define MAXPKTSIZE (8192+256)
#define IOF_QUEUED 0x02
#define IOF_RUN 0x04
#define STRM_RESERVE 0x8000 /* ports reserved for stream protocol */
#define STRM_PORTS 512 /* must be factor of 32 */
typedef unsigned char ubyte;
typedef unsigned short uword;
typedef unsigned long ulong;
typedef struct Library LIB;
typedef struct MsgPort PORT;
typedef struct List LIST;
typedef struct Node NODE;
typedef struct MinNode MNODE;
typedef struct Task Task;
typedef struct Message Message;
typedef struct timerequest IOT;
typedef long (*func_ptr)();
typedef void (*func_void)();
typedef struct {
LIB Lib; /* library node */
ubyte ParAddress; /* 1-255 */
PORT Port; /* task port */
long PLock[2]; /* task lock */
LIST UnitList; /* active units (ports) */
} Device;
/*
* Unit Core Structure (not user accessable) (do not access!)
*/
typedef struct {
NODE Node; /* link node DO NOT MOVE */
func_void BeginIO; /* begin I/O DO NOT MOVE */
func_void AbortIO; /* abort I/O DO NOT MOVE */
func_void CloseFunc;
func_void DataFunc; /* low level packet data */
uword RefCnt;
uword Port; /* core port ident */
uword Protocol; /* protocol id */
ulong DestAddr; /* destination 0 = self */
uword Flags; /* status flags */
uword State; /* (protocol private) */
long UnitLock[2];
LIST PendIOR; /* pending read requests */
LIST PendIOW; /* pending write requests */
LIST PendCon; /* pending connect requests */
LIST PendLsn; /* pending listen requests */
} Unit;
/*
* Io request structure and user defines
*/
#include "devices/parnet.h"
typedef IOParReq Iob;
/*
* A low level network packet
*/
typedef struct {
Message Msg;
Iob *iob; /* IO req (unit_str) */
Unit *io_Unit; /* unit involved */
ubyte DestAddr; /* Destination machine */
ubyte Reserved;
uword DestPort; /* Destination port no. */
ulong DLen1; /* Data Length */
ulong DLen2; /* Data Length */
ubyte *Data1; /* Data Pointer (lw algn) */
ubyte *Data2; /* Data Pointer (lw algn) */
} Packet;
/*
* private public port to remember addr across closes.
*/
typedef struct {
PORT Port;
long Address;
long Timeout;
char DebugBuf[32];
} PubPort;
/*
* Globals
*/
extern long ParLLTimeout; /* par.asm */
extern Device *DevBase;
extern PubPort *StickyPort;
extern Unit *FindUnitForPort();
extern Unit *AllocUnit();
extern Packet *AllocParPacket();
extern void ReadConfig();
extern void WriteConfig();